-
Notifications
You must be signed in to change notification settings - Fork 16
feat(acvm)!: Simplification pass for ACIR #151
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should explore pulling the usage of the simplifier out of acvm::compiler::compile
.
In the context of noir-lang/noir#1102, ideally we'd perform all the generic optimisations separately to the backend-specific optimisations. We can then have our generic ACIR artifacts be optimised and then have acvm::compiler::compile
just tailor them to the backend.
I moved it to the optimizers module |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm okay with this PR -- I think there are things that ideally get cleaned up but since its an optional pass and I predict that we can do this in an ssa optimization pass after legalization, we may be able to remove the need for it and other optimization passes in the future.
Note:
- We should use a separate PR to modify quotient directive (breaking change); its bad practice because it introduces feature creep and it is not indicative from the PR title. One may naively assume that this change is needed for the simplification pass.
- I'd prefer that we put the simplification pass inside of the compile method so its not a special pass that now needs to be initialized.
* master: chore(acvm)!: Backend trait must implement Debug (#275) chore!: remove `OpcodeResolutionError::UnexpectedOpcode` (#274) chore(acvm)!: rename `hash_to_field128_security` to `hash_to_field_128_security` (#271) feat(acvm)!: update black box solver interfaces to match `pwg:black_box::solve` (#268) chore(acir_field): remove unnecessary `to_vec()` (#267) chore(acvm)!: expose separate solvers for AND and XOR opcodes (#266) feat(acvm)!: Simplification pass for ACIR (#151)
* master: (49 commits) feat(acvm)!: Add CommonReferenceString backend trait (#231) fix(acir): Hide variants of WitnessMapError and export it from package (#283) feat!: Introduce WitnessMap data structure to avoid leaking internal structure (#252) feat!: use struct variants for blackbox function calls (#269) chore(acvm)!: Backend trait must implement Debug (#275) chore!: remove `OpcodeResolutionError::UnexpectedOpcode` (#274) chore(acvm)!: rename `hash_to_field128_security` to `hash_to_field_128_security` (#271) feat(acvm)!: update black box solver interfaces to match `pwg:black_box::solve` (#268) chore(acir_field): remove unnecessary `to_vec()` (#267) chore(acvm)!: expose separate solvers for AND and XOR opcodes (#266) feat(acvm)!: Simplification pass for ACIR (#151) changes the name of blake to be blakes2s256 (#261) update hash functions (#260) feat!: Remove `solve` from PWG trait & introduce separate solvers for each blackbox (#257) chore: Release 0.11.0 (#250) feat(acvm): Add generic error for failing to solve an opcode (#251) fix(acir): Fix `Expression` multiplication to correctly handle degree 1 terms (#255) chore(acir): organise opcodes definitions (#254) chore: remove usage of `insert_witness` with `insert_value` (#253) feat: Add Keccak Hash function (#259) ...
Related issue(s)
Related to the noir issue 573
Description
Summary of changes
This PR adds a simplification pass for ACIR which indicates redundant opcodes
The simplification pass is not run automatically and must be called explicitly.
The simplification is applied during the fallback transformation, avoiding to re-process all the opcodes inside another pass.
Dependency additions / changes
Compiling ACIR requires now to pass a simplifier, which will apply the simplification. If one does not wish do to any simplification, he can simply provides the default simplifier.
Test additions / changes
Unit test is added
Checklist
cargo fmt
with default settings.